import React from "react";
import { Link } from "react-router-dom";

/**
 * state 传递参数，需要传递一个 state 的对象过去
 *
 *  to="string" 的写法就不合适了
 *  to={{
 *    pathname: '/detail',
 *    state: {
 *        id: 1,
 *        title: 'abc'
 *    }
 *  }}
 */

export default function Help() {
  return (
    <div>
      <h1>Help</h1>
      <ul>
        <li>
          <Link
            to={{
              pathname: "/detail",
              state: {
                id: 1,
                title: "abc",
              },
            }}
          >
            Help - 1
          </Link>
        </li>
        <li>
          <Link
            to={{
              pathname: "/detail",
              state: {
                id: 2,
                title: "abc",
              },
            }}
          >
            Help - 2
          </Link>
        </li>
        <li>
          <Link
            to={{
              pathname: "/detail",
              state: {
                id: 3,
                title: "abc",
              },
            }}
          >
            Help - 3
          </Link>
        </li>
      </ul>
    </div>
  );
}
